﻿using MediatR;
using T.Vehicleservice.API.Application.Command.TireUsageRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.TireUsageRecordHandler
{
    public class TireUsageRecordCreateCommandHandler : IRequestHandler<TireUsageRecordCreateCommand, int>
    {
        private readonly ITireUsageRecordRepository _repository;
        public TireUsageRecordCreateCommandHandler(ITireUsageRecordRepository repository)
        {
            _repository = repository;
        }
        public async Task<int> Handle(TireUsageRecordCreateCommand request, CancellationToken cancellationToken)
        {
            return await _repository.AddAsync(request);
        }
    }
}
